---@class Table_ComItemItem
local Table_ComItemItem = BaseClass("Table_ComItemItem", IDataItem)

function Table_ComItemItem:__ctor()
	---@type number @唯一ID
	self.Id = 0
	---@type string @名称
	self.Name = ""
	---@type string @说明
	self.Desc = ""
	---@type string @图标名称
	self.Icon = ""
	---@type string @图标图集
	self.Atlas = ""
	---@type number @品质
	self.Quality = 0
	---@type number @堆叠上限
	self.StackSize = 0
	---@type number @总量上限
	self.MaxStack = 0
	---@type number @道具类型
	self.ClassType = 0
	---@type number @存放类型
	self.StorageType = 0
	---@type number @使用类型
	self.UseType = 0
	---@type number[] @使用参数
	self.UseParam = {}
	---@type string @产出途径
	self.OutPath = ""
	---@type number @产出类型
	self.OutType = 0
	---@type number @表格Id
	self.OutId = 0
	---@type boolean @是否可以出售
	self.IsSell = false
	---@type number @卖出货币类型
	self.ResType = 0
	---@type number[] @卖出价格
	self.Price = {}
	---@type number @排序优先级
	self.SortId = 0
end

function Table_ComItemItem:Load(reader)
	self.temp = reader:ReadShortString()
	self.Id = tonumber(self.temp)
	self.Name = reader:ReadString()
	self.Desc = reader:ReadString()
	self.Icon = reader:ReadString()
	self.Atlas = reader:ReadString()
	self.temp = reader:ReadShortString()
	self.Quality = tonumber(self.temp)
	self.temp = reader:ReadShortString()
	self.StackSize = tonumber(self.temp)
	self.temp = reader:ReadShortString()
	self.MaxStack = tonumber(self.temp)
	self.temp = reader:ReadShortString()
	self.ClassType = tonumber(self.temp)
	self.temp = reader:ReadShortString()
	self.StorageType = tonumber(self.temp)
	self.temp = reader:ReadShortString()
	self.UseType = tonumber(self.temp)
	self.temp = reader:ReadShortString()
	self.UseParam = Utility.StringToNumbers(self.temp)
	self.OutPath = reader:ReadString()
	self.temp = reader:ReadShortString()
	self.OutType = tonumber(self.temp)
	self.temp = reader:ReadShortString()
	self.OutId = tonumber(self.temp)
	self.IsSell = reader:ReadBool()
	self.temp = reader:ReadShortString()
	self.ResType = tonumber(self.temp)
	self.temp = reader:ReadShortString()
	self.Price = Utility.StringToNumbers(self.temp)
	self.temp = reader:ReadShortString()
	self.SortId = tonumber(self.temp)
end

---@class Table_ComItemMgr : IDataMgr
local this = BaseClass("Table_ComItemMgr", IDataMgr)

function this:FileName()
	return "Txt/ComItem.txt"
end

---@return Table_ComItemItem
function this:GetItemByKey(key)
	return self.super.GetItemByKey(self, key)
end

---@return Table_ComItemItem
function this:GetItemByIdx(idx)
	return self.super.GetItemByIdx(self, idx)
end

function this:Load(reader)
	local item = Table_ComItemItem()
	item:Load(reader)
	self.mItemDic[item.Id] = self.mDataCount
	table.insert(self.mItemList, item)
end

---@type Table_ComItemMgr
Table_ComItemMgr = this()